<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
	<ui:composition template="template/template.xhtml">
		<ui:define  name="page-title" >#{messages.utilizador}</ui:define >
		<ui:define  name="center">
        	<h:outputText styleClass="title" value="#{messages.utilizador}"/>
        	<p:messages id="messages" autoUpdate="true"/> 
           	<h:panelGrid columns="2">
				<h:outputLabel value="#{messages.tipo}" for="tipo"/>
	 			<p:selectOneMenu id="tipo" value="#{userController.utilizador.perfilUtilizador}" >  
                      <f:selectItems value="#{userController.perfisUtilizador}" var="perfil" />  
                 </p:selectOneMenu > 
				
	 			<h:outputLabel value="#{messages.username}" for="username"/>
	 			<p:inputText id="username" value="#{userController.utilizador.username}" required="true"/>
	 		
	 			<h:outputLabel value="#{messages.nome}" for="name"/>
	 			<p:inputText id="name" value="#{userController.utilizador.nome}" required="true"/>
	 		
				<h:outputLabel for="nif" value="#{messages.nif}" /> 
          			<p:inputText id="nif" value="#{userController.utilizador.nif}" required="true"/>
          	
				<h:outputLabel for="bi" value="#{messages.bi}" /> 
          			<p:inputText id="bi" value="#{userController.utilizador.bi}" required="true"/>
        
				<h:outputLabel for="contact" value="#{messages.telefone}" /> 
          			<p:inputText id="contact" value="#{userController.utilizador.telefone}" required="true"/>

				<h:outputLabel for="password" value="#{messages.password}" /> 
				<p:inputText id="password" value="#{userController.utilizador.password}" required="true"/>
          	
     					<h:column>
     						<p:commandButton value="#{messages.voltar}" action="utilizadores" ajax="false" immediate="true" rendered="#{loginController.administrador}"/> 
     					</h:column>
     					<h:column>
     						<p:commandButton value="#{messages.guardar}" action="#{userController.saveUtilizadorAction}"  ajax="false"/> 
     					</h:column>
			</h:panelGrid>
		</ui:define >
	</ui:composition>
	
</html>